<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8" />
    <title>系统枚举表</title>
    <script src="/static/skin.js"></script>
	<link rel="stylesheet" href="/static/basic/plugins/easyui/themes/icon.css" >
	<script src="https://cdn.staticfile.org/jquery/3.4.1/jquery.min.js"></script>
	<script src="/static/basic/plugins/easyui/jquery.easyui.min.js"></script>
	<script src="/static/init.js"></script>
	<script src="/static/searchEdit.js?v=0326"></script>
	<script src="/static/basic/plugins/easyui/locale/easyui-lang-zh_CN.js"></script>
	<script src="https://cdn.staticfile.org/moment.js/2.24.0/moment.min.js"></script>
	<link rel="stylesheet" href="/static/m.css" >
</head>
<body>
<div class="easyui-layout" data-options="fit:true"  >
	<div data-options="region:'center'" >
		<table id="gridList" ></table>
	</div>
</div>
<div id="searchbar">
<div class="maction">
		<a href="javascript:void(0)" id="addButton" class="easyui-linkbutton" data-options="plain:true,iconCls:'icon-add'">新增</a>
		<a href="javascript:void(0)" id="showChangesButton" class="easyui-linkbutton" data-options="plain:true,iconCls:'icon-edit'">信息变更提示</a>
        <a href="javascript:void(0)" id="rejectButton" class="easyui-linkbutton" data-options="iconCls:'icon-undo',plain:true" >撤销</a>
		<a href="javascript:void(0)" id="removeButton" class="easyui-linkbutton" data-options="plain:true,iconCls:'icon-remove'">删除</a>
		<a href="javascript:void(0)" id="saveButton" class="easyui-linkbutton" data-options="plain:true,iconCls:'icon-save'">保存</a>
		<a href="javascript:void(0)" id="btn1" class="easyui-linkbutton" data-options="plain:true">生成常量类</a>
</div>
<form id="searchForm" >
	key:<input id="search-code_key" name="code_key" class="easyui-textbox" >
	name:<input id="search-code_name" name="code_name" class="easyui-textbox" >
	value:<input id="search-code_value" name="code_value" class="easyui-textbox" >
	是否生成常量:<input id="search-is_constants" name="is_constants" class="easyui-textbox" >
	<a id="searchButton" href="javascript:void(0)" class="easyui-linkbutton" data-options="plain:true,iconCls:'icon-search'" >查询</a>
</form>
</div>
<script>
var options={
		page_id:201,
		grid_id:"gridList",
		sqlname:"grid_201_sys_enum",
		showCheckbox:false,
		rownumbers:false,
	};
	//document ready
	$(function(){
		grid1=new uniontrip.datagrid.searchEdit(options);
		
		$('#searchButton').bind('click',grid1.load);//查询操作绑定事件
		$('#addButton').bind('click', addRow);//新增行绑定事件
		$('#editButton').bind('click',grid1.editRow);//编辑按钮绑定事件
		$('#removeButton').bind('click',grid1.remove);//删除行绑定事件
		$('#saveButton').bind('click', grid1.accept);//保存datagrid绑定事件
		$('#cancelEditButton').bind('click',grid1.cancelEditing);//取消行编辑绑定事件
		$('#endEditingButton').bind('click', grid1.endEditing);//结束行编辑绑定事件
		$('#rejectButton').bind('click', grid1.rejectChanges);//撤销编辑绑定事件		
	    $('#showChangesButton').bind('click',grid1.showChanges);//信息变更提示
	    $('#btn1').bind('click', generateConstants);
	    //初始化搜索框
	    initsearch();
	    initsessioninfo();
	});
	function generateConstants(){
		$.mypost("/authenticated/generate/constants",JSON.stringify({}),function(result){
			if(result.success){
				$.messager.alert("提示", "生成成功！");
			}else{
				$.messager.alert("提示", result.message);
			}
		});
	}
	/**
	 * 新增一行
	 */
	function addRow(){
		var newRowData={id:guid()};//初始化行数据
		grid1.grid.datagrid('append',newRowData);	
	}

	function onDeleteRow(){
		gridConfirm(grid1.grid,"是否确认删除",deleteRow);
	}
	function deleteRow(row){
		$._post("/authenticated/xx/delete",JSON.stringify({"id":row.id}),function(result){
			if(result.success){
				$.messager.alert("提示", "删除成功！");
				grid1.load();
			}else{
				$.messager.alert("提示", "删除失败！<br>"+result.message);
			}
		});
	}


	/**
	 * 初始化搜索条件
	 */
	function initsearch(){
		/*$('#search-product_class_id').combotree({
			icons: [{
				iconCls:'icon-clear',
				handler:function(){
					$('#search-product_class_id').combotree('clear');
				}
			}],
		    data:grid1.combotreeDatas.product_class_id
		});
		//初始化combobox例子
		$('#search-status').combobox({
			panelHeight:'auto',
			editable:false,
			valueField:'code_value',
			textField:'code_name',
			icons: [{
				iconCls:'icon-clear',
				handler:function(e){
					$(e.data.target).combobox('clear');
				}
			}],
		    data:grid1.comboboxDatas.status
		});*/
	}
</script>
</body>
</html>